<template>
  <transition name="fade">
    <div class="message" :class="type" v-if="visible">
      <i class="icon-type iconfont" :class="'icon-'+type"></i>
      <div class="content">{{content}}
        <i v-if="hasClose" class="btn-close iconfont icon-close" @click="visible=false"></i>
      </div>
    </div>
  </transition>
</template>

<script>
    export default {
        name: "backResponse",  // 提示（弹出框）
        props: {

        },
        data() {
            return {
                content: '',
                time: 3000,
                visible: false,
                type:'info',//'success','warning','error'
                hasClose:false,
            }
        },
        mounted() {
            this.close()
        },
        // watch() {
        //     type: {
        //         handler() {
        //
        //         }
        //     }
        // },
        methods: {
            close() {
                window.setTimeout(() =>{
                    this.visible = false
                }, this.time);
            }
        }
    }
</script>

<style scoped lang="scss">
  .message{
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translate(-50%,-50%);
    /*border: 1px solid red;*/
    /*background-color: #fff;*/
  }
</style>